/*
 * VectorTests.h
 *
 */
#ifndef _VECTOR_TESTS_H_
#define _VECTOR_TESTS_H_

#include <cppunit/TestCase.h>
#include <cppunit/TestSuite.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestAssert.h>

#include "Real.h"
#include "Vector.h"

class VectorTests : public CppUnit::TestFixture
{
	CPPUNIT_TEST_SUITE(VectorTests);
	CPPUNIT_TEST(testAddition);
	CPPUNIT_TEST(testSubtraction);
	CPPUNIT_TEST(testMultiplicationByScalar);
	CPPUNIT_TEST_SUITE_END();

public:

	void setUp() { }

	void tearDown() { }

	void testAddition() {
		Vector e1(1.0, 0.0, 0.0);
		Vector e2(0.0, 1.0, 0.0);
		Vector expected(1.0, 1.0, 0.0);
		Vector actual(e1 + e2);

		CPPUNIT_ASSERT_EQUAL(expected, actual);
	}

	void testSubtraction() {
		Vector v1(1.0, 1.0, 0.0);
		Vector v2(0.0, 1.0, 1.0);
		Vector expected(1.0, 0.0, -1.0);
		Vector actual(v1 - v2);

		CPPUNIT_ASSERT_EQUAL(expected, actual);
	}

	void testMultiplicationByScalar() {
		Real scalar(5.0);
		Vector v(1.0, 2.0, 3.0);
		Vector expected(5.0, 10.0, 15.0);
		Vector actual(scalar * v);

		CPPUNIT_ASSERT_EQUAL(expected, actual);
	}
};

#endif /* _VECTOR_TESTS_H_ */
